#include <string.h>
#include "audio_mem.h"
#include "esp_log.h"
#include "driver/adc.h"
#include "esp_adc_cal.h"
#include "battery_service.h"
#include "audio_pipeline.h"
#include "audio_event_iface.h"

#define PIN_NUM_BATEN 14

/**
 * @brief Battery adc configure
 */
typedef struct
{
    int unit;    /*!< ADC unit, see `adc_unit_t` */
    int chan;    /*!< ADC channel, see `adc_channel_t` */
    int width;   /*!< ADC width, see `adc_channel_t` */
    int atten;   /*!< ADC atten, see `adc_atten_t` */
    int v_ref;   /*!< default vref` */
    float ratio; /*!< divider ratio` */
} vol_adc_param_t;

esp_err_t battery_service_cb(periph_service_handle_t handle, periph_service_event_t *evt, void *ctx);
int vol_read(void *user_data);
bool adc_init(void *user_data);
bool adc_deinit(void *user_data);
